<?php
// start session
session_start();

// include configuration file + db connection
include 'config.php';

// include loader -> loads other mandatory files
include 'loader.php';

ob_start(); //start output buffer, everything goes to {content}

//create classes
$db = new DB($dbserver,$dbuser,$dbpassword,$dbname); //values from config
$core = new Core();
$theme = new Theme();

//starting router
//router will can plugins and they will echo their outputs
$core->router();

$content = ob_get_contents();

ob_end_clean();

//assign content
$theme->assign('content',$content);

//generate menu from DB table `yaps_menu`
$theme->generate_menu();

//do stuff with other plugins (like twitter plugin, sidebar plugin etc)
$theme->do_other_plugins_stuff();

//if something wasn`t set, set it now for default
$theme->set_defaults();

//throw it on user :)
if($theme->render == true)
{
	//print msg/errors
	$core->print_alert();
	$theme->render();
}

?>